package com.school;

public class Stringdemo6 {
    public static void main(String[] args) {
        //String replace(旧值，新值)替换
        //获取到说的话
        String say="你他妈真他妈牛逼,你个臭傻逼，操你妈，滚你你妈逼";
        //把他妈替换成**
        String result=say.replace("他妈","**");


        System.out.println(result);
        //定义一个敏感词库
        String[] arr={"他妈","傻逼","操你妈","你妈逼"};

        //循环得到每一个敏感词进行替换
        for (int i = 0; i < arr.length; i++) {
            say=say.replace(arr[i],"**");
        }
        System.out.println(say);



    }
}
